package yxm.zyf.love.service.impl;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.plugin.core.PluginRegistry;
import org.springframework.stereotype.Component;

import yxm.zyf.love.domian.MobileCustomer;
import yxm.zyf.love.service.MobileIncrementBusiness;

@Component
public class CustomerService {

    
//    @Autowired
//    MobileIncrementV1 mobileIncrementV1;
//
//    public void increments(MobileCustomer mobileCustomer,int money){
//        //对人员进行充值
//        mobileIncrementV1.increment(mobileCustomer,money);
//    }

    @Resource(name ="mobileIncrementBusinessRegistry")
    private PluginRegistry<MobileIncrementBusiness,MobileCustomer> mobileCustomerPluginRegistry;
  

    public void increments(MobileCustomer mobileCustomer,int money){
        //获取插件
        List<MobileIncrementBusiness> plugins=mobileCustomerPluginRegistry.getPlugins();
        for (MobileIncrementBusiness incrementBusiness:plugins){
            //对人员进行充值
            incrementBusiness.increment(mobileCustomer,money);
        }
    }

}
